home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacPerl 4.1.3 / lib / look.pl < prev    next >
Encoding:
Text File  |  1993-10-23  |  1.0 KB  |  14 lines  |  [TEXT/MPS ]

  1. ;# Usage: &look(*FILEHANDLE,$key,$dict,$fold)
  2.  
  3. ;# Sets file position in FILEHANDLE to be first line greater than or equal
  4. ;# (stringwise) to $key.  Pass flags for dictionary order and case folding.
  5.  
  6. sub look {
  7.     local(*FH,$key,$dict,$fold) = @_;
  8.     local($max,$min,$mid,$_);
  9.     local($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  10.        $blksize,$blocks) = stat(FH);
  11.     $blksize = 8192 unless $blksize;
  12.     $key =~ s/[^\w\s]//g if $dict;
  13.     $key =~ y/A-Z/a-z/ if $fold;
  14.     $max = int(